<template>
  <div>
    <el-dialog title="添加好友" :visible.sync="dialogFormVisible">
      <el-form :model="form">
        <el-form-item label="微信号/昵称">
          <el-input v-model="form.friendUniqueIdentification" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="change">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { mapState } from 'vuex'
import { addFriend } from '@/api/friendlist/friendList'

export default {
  name: 'AddFriend',
  data() {
    return {
      dialogFormVisible: false,
      form: {
        friendUniqueIdentification: ''
      },
      formLabelWidth: '120px'
    }
  },
  computed: {
    ...mapState([
      'user'
    ])
  },
  methods: {
    changeStatus() {
      this.dialogFormVisible = true
    },
    change() {
      const res = {
        originId: this.user.userId,
        targetId: this.form.friendUniqueIdentification
      }
      debugger
      addFriend(res)
      this.form.friendUniqueIdentification = ''
      this.dialogFormVisible = false
    }
  }
}
</script>

<style scoped>

</style>
